package com.hxc.apply.service.impl;

import java.util.List;

import com.hxc.apply.mapper.TApplyInfoMapper;
import com.hxc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hxc.apply.domain.TApplyInfo;
import com.hxc.apply.service.ITApplyInfoService;

/**
 * 在线办理应用信息Service业务层处理
 * 
 * @author hxc
 * @date 2021-08-16
 */
@Service
public class TApplyInfoServiceImpl implements ITApplyInfoService 
{
    @Autowired
    private TApplyInfoMapper tApplyInfoMapper;

    /**
     * 查询在线办理应用信息
     * 
     * @param id 在线办理应用信息主键
     * @return 在线办理应用信息
     */
    @Override
    public TApplyInfo selectTApplyInfoById(Long id)
    {
        return tApplyInfoMapper.selectTApplyInfoById(id);
    }

    /**
     * 查询在线办理应用信息列表
     * 
     * @param tApplyInfo 在线办理应用信息
     * @return 在线办理应用信息
     */
    @Override
    public List<TApplyInfo> selectTApplyInfoList(TApplyInfo tApplyInfo)
    {
        return tApplyInfoMapper.selectTApplyInfoList(tApplyInfo);
    }

    /**
     * 新增在线办理应用信息
     * 
     * @param tApplyInfo 在线办理应用信息
     * @return 结果
     */
    @Override
    public int insertTApplyInfo(TApplyInfo tApplyInfo)
    {
        tApplyInfo.setCreateTime(DateUtils.getNowDate());
        return tApplyInfoMapper.insertTApplyInfo(tApplyInfo);
    }

    /**
     * 修改在线办理应用信息
     * 
     * @param tApplyInfo 在线办理应用信息
     * @return 结果
     */
    @Override
    public int updateTApplyInfo(TApplyInfo tApplyInfo)
    {
        return tApplyInfoMapper.updateTApplyInfo(tApplyInfo);
    }

    /**
     * 批量删除在线办理应用信息
     * 
     * @param ids 需要删除的在线办理应用信息主键
     * @return 结果
     */
    @Override
    public int deleteTApplyInfoByIds(Long[] ids)
    {
        return tApplyInfoMapper.deleteTApplyInfoByIds(ids);
    }

    /**
     * 删除在线办理应用信息信息
     * 
     * @param id 在线办理应用信息主键
     * @return 结果
     */
    @Override
    public int deleteTApplyInfoById(Long id)
    {
        return tApplyInfoMapper.deleteTApplyInfoById(id);
    }

    /**
     * 功能描述: 应用信息列表(树形)
     * @author yzj
     */
    @Override
    public List<TApplyInfo> queryApplyList() {
        List<TApplyInfo> list = tApplyInfoMapper.queryApplyList();
        list.forEach((var)->{
            List<TApplyInfo> list1 = tApplyInfoMapper.queryApplyNextList(var.getId());
            var.setAppluSonList(list1);
        });
        return list;
    }

    @Override
    public List<TApplyInfo> queryApply(String applyId) {
        List<TApplyInfo> tApplyInfos = tApplyInfoMapper.queryApply(applyId);
        return tApplyInfos;
    }
}
